using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Lzfy_His_Service.Models
{
    public class CallLog
    {
        public int Id { get; set; }
        
        [Column("input_date")]
        public DateTime? InputDate { get; set; }
        
        [Column("username")]
        public string? Username { get; set; }
        
        [Column("fullname")]
        public string? Fullname { get; set; }
        
        [Column("call_phone")]
        public string? CallPhone { get; set; }
        
        [Column("user_phone")]
        public string? UserPhone { get; set; }
        
        [Column("send_msg")]
        public short? SendMsg { get; set; }
    }

    public class CallLogQueryRequest
    {
        public string? Username { get; set; }
        public string? Fullname { get; set; }
        public string? CallPhone { get; set; }
        public string? UserPhone { get; set; }
        public short? SendMsg { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }
        public int PageIndex { get; set; } = 1;
        public int PageSize { get; set; } = 10;
    }

    public class CallLogQueryResponse
    {
        public List<CallLog> Items { get; set; } = new List<CallLog>();
        public int TotalCount { get; set; }
        public int PageIndex { get; set; }
        public int PageSize { get; set; }
        public int TotalPages => (int)Math.Ceiling((double)TotalCount / PageSize);
    }

    public class CallLogCreateRequest
    {
        [Required(ErrorMessage = "用户名不能为空")]
        public string? Username { get; set; }
        
        public string? Fullname { get; set; }
        
        [Required(ErrorMessage = "呼叫电话不能为空")]
        public string? CallPhone { get; set; }
        
        public string? UserPhone { get; set; }
        public short? SendMsg { get; set; }
    }

    public class CallLogUpdateRequest
    {
        public int Id { get; set; }
        public string? Username { get; set; }
        public string? Fullname { get; set; }
        public string? CallPhone { get; set; }
        public string? UserPhone { get; set; }
        public short? SendMsg { get; set; }
    }
}